﻿/*  ----------------------------------------------------------------------------
 *  SysServer
 *  ----------------------------------------------------------------------------
 *  File:       SocketListenerSetting.cs
 *  Creater:     SEEN\MistSeen
 *  ----------------------------------------------------------------------------
 *  $Date: 2010-09-06 10:36:01 +0000 (Mon, 06 Sep 2010) $
 *  $Rev: 15 $
 *  $Author: ScorDeity $
 *  $URL: http://sysserver.googlecode.com/svn/trunk/src/SysServer/Sock/SocketListenerSetting.cs $
 *  $Id: SocketListenerSetting.cs 15 2010-09-06 10:36:01Z ScorDeity $
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace SysServer.Sock
{
    using System.Net;
    /// <summary>
    /// Listtener的设定类.
    /// </summary>
    public class SocketListenerSetting
    {
        /// <summary>
        /// the maximum number of connections the sample is designed to handle simultaneously 
        /// </summary>
        private int _MaxConnectionCount;
        /// <summary>
        /// max # of pending connections the listener can hold in queue
        /// </summary>
        private int _BackLog;
        /// <summary>
        /// 
        /// </summary>
        private int _MaxSimutaneousAcceptOps;

        private int _ReceiveBufferSize;

        private int _ReceivePrefixLength;

        private int _SendPrefixLength;

        private int _OpsToPreAllocate;

        private IPEndPoint _LocalEndPoint;


        public SocketListenerSetting(
            int maxConectionCount, int backlog, int maxSimultaneousAcceptOps, int receivePrefixLength, int receiveBufferSize,
            int sendPrefixLength, int opsToPreAlloc, IPEndPoint localEndPoint)
        {
            this._MaxConnectionCount = maxConectionCount;
            this._BackLog = backlog;
            this._MaxSimutaneousAcceptOps = maxSimultaneousAcceptOps;
            this._ReceivePrefixLength = receivePrefixLength;
            this._ReceiveBufferSize = receiveBufferSize;
            this._SendPrefixLength = sendPrefixLength;
            this._OpsToPreAllocate = opsToPreAlloc;
            this._LocalEndPoint = localEndPoint;

        }

        /// <summary>
        /// 最大链接数
        /// </summary>
        public int MaxConnectionCount
        {
            get { return this._MaxConnectionCount; }
        }
        /// <summary>
        /// Socket Lister 挂起连接队列的最大长度。
        /// </summary>
        public int Backlog
        {
            get { return this._BackLog; }
        }
        /// <summary>
        /// 最大的Accept操作的响应链接数目
        /// </summary>
        public int MaxAcceptConnectionCount
        {
            get { return this._MaxSimutaneousAcceptOps; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int ReceivePrefixLength
        {
            get { return this._ReceivePrefixLength; }
        }
        /// <summary>
        /// stockAnycArg中关于buffer 的大小
        /// </summary>
        public int BufferSize
        {
            get { return this._ReceiveBufferSize; }
        }
        public int SendPrefixLength
        {
            get { return this._SendPrefixLength; }
        }

        public int OpsToPreAllocate
        {
            get { return this._OpsToPreAllocate; }
        }
        /// <summary>
        /// 本地链接地址
        /// </summary>
        public IPEndPoint LocalEndPoint
        {
            get { return this._LocalEndPoint; }
        }
    }
}